<table width="100%">
  <tr>
    <td colspan=2><font class="text"><b><?=translate('edit_aboutus');?></b><br>
      <br>
      <?=translate('edit_aboutus_desc1');?>
      <a href="http://www.duoservers.com/?r=<? echo $userName; ?>" target="_blank"><?=translate('edit_aboutus_desc2');?></a>
      <?=translate('edit_aboutus_desc3');?>
      </font></td>
  </tr>
</table>
<br>
<br>
<?php
	$params['sid'] = $sid;
	$params['action'] = "editAboutUs";
	$url = "$baseURL/$webDIR/?".encode_params($params);
	
	$store_name = get_store_name($id);
	
	if($errorMsg) {
		include ('errorMsg.html');
	}
	
	if($okMsg) {
		$okMsg = translate('successufully_changed_aboutus');
		include ('okMsg.html');
	}
	
	// This function uses anyDb layer to connect to the PostgreSQl on verdi
	$about_us = get_aboutus($master_db, $id, 'about_us');
	
	// get reseller details for default text
	$resellerDetails = list_details($id, 'array');
	$resellerDetails = $resellerDetails[0];
	$replaceStrings = array (
		'%store_name%' => $store_name,
		'%company_name%' => $resellerDetails['company_name'],
		'%country%' => get_country_name($resellerDetails['country']),
		'%city%' => $resellerDetails['city'],
		'%state%' => $resellerDetails['state'],	
	);
	// replace values in the text
	foreach ($store_aboutus_data as $key => $value) {
		foreach($replaceStrings as $replaceKey => $replaceValue) {
			$value = str_replace($replaceKey, $replaceValue, $value);
			$store_aboutus_data[$key] = str_replace($replaceKey, $replaceValue, $value);
		}
	}
	// end: get reseller details for default text
?>
<TABLE border=1 class='bTable' cellspacing='0'>
  <form action='<?=$url;?>' method='POST' onSubmit="javascript: return confirm('<?php echo translate('are_you_sure'); ?>');">
	<tr>
		<th colspan="2"><?=translate('who_we_are');?></th>
	</tr>
	<tr>
		<td><textarea id="area1" name="aboutus[who_we_are]" rows="8" cols="50"><?php echo $about_us['who_we_are']; ?></textarea></td>
		<td valign="top">
			<input type='button' value='<?=translate('clear_field');?>' onClick="this.form.area1.value = '';">
			<br /><br />
			<input type='button' value='<?=translate('set_default_text');?>' onClick='this.form.area1.value = "<? echo $store_aboutus_data['who_we_are'];?>";'>
		</td>
	</tr>
	<tr>
		<th colspan="2"><?=translate('our_mission');?></th>
	</tr>
	<tr>
		<td><textarea id="area2" name="aboutus[our_mission]" rows="8" cols="50"><?php echo $about_us['our_mission']; ?></textarea></td>
		<td valign="top">
			<input type='button' value='<?=translate('clear_field');?>' onClick="this.form.area2.value = '';">
			<br /><br />
			<input type='button' value='<?=translate('set_default_text');?>' onClick="this.form.area2.value = '<? echo $store_aboutus_data['our_mission'];?>';">
		</td>
	</tr>
	<tr>
		<th colspan="2"><?=translate('our_client_base');?></th>
	</tr>
	<tr>
		<td><textarea id="area3" name="aboutus[our_client_base]" rows="8" cols="50"><?php echo $about_us['our_client_base']; ?></textarea></td>
		<td valign="top">
			<input type='button' value='<?=translate('clear_field');?>' onClick="this.form.area3.value = '';">
			<br /><br />
			<input type='button' value='<?=translate('set_default_text');?>' onClick="this.form.area3.value = '<? echo $store_aboutus_data['our_client_base'];?>';">
		</td>
	</tr>
	<tr>
		<td colspan='2' align='center'><input type='submit' value='<?=translate('save');?>'> <input type='button' value='<?=translate('cancel');?>' onClick="window.location.href='<?php echo $_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING'];?>'"></td>
	</tr>
</form>
</TABLE>